package paiement;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

import hibernate.*;
import general.*;

public class AutrePaiementAction extends NotreServlet{
        public ActionForward execute( ActionMapping pMapping, ActionForm pForm, HttpServletRequest pRequest, HttpServletResponse pResponse)
        {
                ActionErrors errors = new ActionErrors();
        int id_commande;
        id_commande=(Integer)pRequest.getAttribute("Num_Commdand ");
                HttpSession httpsession = pRequest.getSession();
                Object objClient = httpsession.getAttribute("personne");
                
                Personne client = (Personne) objClient;
                
        try {
                  //GestionGenerationPDF.genereFichierPdf(Integer.toString(client.getId()), Integer.toString(id_commande), pRequest.getSession().getServletContext(), panier,panier.getMontantTotal()-panier.getTotalAPayer());
                } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                        errors.add("errors",new ActionMessage("errors.exception"));
                        saveErrors(pRequest,errors);
                        return (new ActionForward(pMapping.getInput()));
                }

        httpsession.removeAttribute("panier");
        return pMapping.findForward("success");
        }
        
}
